package com.rongma.waterdrop.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.rongma.waterdrop.global.WaterDropApplication;

/**
 * Created by RongMa on 16/6/18.
 */
public class WaterDropHelper extends SQLiteOpenHelper
{
    private static final int DB_VERSION = 1;
    private static final String CREATE_DEFAULTNEWS = "CREATE TABLE defaultnews (type integer,content text,score integer)";
    private static final String CREATE_TASK = "CREATE TABLE task (planTitle text,planContent text,status integer,score integer,upload integer)";
    private static final String CREATE_TIME = "CREATE TABLE time(recordDate text,codeTime integer,sleepTime integer,timeIndex integer PRIMARY KEY,upload integer)";
    private static final String CREATE_TIMEREVENT="CREATE TABLE timerevent(iconBg integer,iconSrc integer,title text,content text,time integer,status integer,iconColor integer,upload integer)";
    private static final String CREATE_USER = "CREATE TABLE user(username text,imageUrl text,score integer,signature text,codeTime integer,upload integer)";

    public WaterDropHelper(Context context) {
        super(context, "waterdrop.db", null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db)
    {
        db.execSQL(CREATE_DEFAULTNEWS);
        db.execSQL(CREATE_TASK);
        db.execSQL(CREATE_TIME);
        db.execSQL(CREATE_TIMEREVENT);
        db.execSQL(CREATE_USER);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
